package com.lyb.redisspringboot.interceptor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Random;

/**
 * @author lyb
 * @create 2022/3/12-18:57
 * @method
 */
@Slf4j
public class KillInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        request.setAttribute("uid", new Random().nextInt(50000) + "");
        request.setAttribute("prodid", "0101");

        return true;
    }
}
